<?php

namespace App\Models\Landscaping;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Vegetation extends Model
{
    //
    use SoftDeletes;
    protected $guarded = [];

    //查询list
    public function getList($request)
    {
    	$per_page = $request->input('per_page',10);
    	return self::orderBy('sort','desc')
                ->where(function($query) use ($request){
                    //检测当前的请求中是否包含record_name、upload_id参数
                    $name = $request->input('name', '');//植被名称
                    if(!empty($name)) {
                        $query->where('name','like','%'.$name.'%');
                    }
                })
                ->paginate($per_page);
    }

}
